#ifndef __IOTGO_SERVICE_C__
#define __IOTGO_SERVICE_C__

#include "iotgo_platformAPI.h"

/*macro: error */
#define IOTGO_ERROR_NONE                   0
#define IOTGO_ERROR_WIFI_CONNECT          -1
#define IOTGO_ERROR_DSERVER_DISCONNECTED  -2
#define IOTGO_ERROR_LSERVER_DISCONNECTED  -3
#define IOTGO_ERROR_PAIR_NOT_FINISHED     -4
#define IOTGO_ERROR_FORBID                -5

/*macro: iotgo state*/
#define IOTGO_IDLE                  0     
#define IOTGO_AP_IS_CONNECTED       1
#define IOTGO_DSERVER_IS_CONNECTED  2
#define IOTGO_LSERVER_IS_CONNECTED  3
#define IOTGO_REGISTER_IS_READY     4
#define IOTGO_PAIR_WITH_APP         5
#define IOTGO_UPGRADE               6

/*macro: data type*/
#define IOTGO_DATA_TYPE_NONE     0
#define IOTGO_DATA_TYPE_UPDATE   1
#define IOTGO_DATA_TYPE_UPGRADE  2
#define IOTGO_DATA_TYPE_DATE     3
#define IOTGO_DATA_TYPE_PARAM    4

extern int iotgoDataServiceRuntime(void);
extern int iotgoDataServiceClean(void);
extern int iotgoPairWithAppStart(void);
extern int iotgoPairWithAppStop(void);
//extern int iotgoUpgrade(void);
extern int iotgoGetState(void);

extern int32_t iotgoWriteErrorNumToServer(uint32_t num, uint8_t *sequence);
extern int32_t iotgoWriteUpdateToServer(uint8_t *params);
extern int32_t iotgoWriteQueryToServer(uint8_t *params);
extern int32_t iotgoReadByDataType(uint8_t type, uint8_t *sequence, uint8_t *params);

extern int32_t iotgoReadUserApiKey(uint8_t *user_api_key);

#endif 

